<?php

// 店铺设置

namespace app\client\model;

use think\Model;
use think\Request;

class ShopHome extends Model
{
    // 模型事件
    protected static function init()
    {

        // 写入前
        self::event('before_write', function ($data) {
            if (Request::instance()->file()) {
                $data->left_img = uploadImg('left_img', 'shop');                    // 左侧图
                $data->right_img_one = uploadImg('right_img_one', 'shop');          // 右图1
                $data->right_img_two = uploadImg('right_img_two', 'shop');          // 右图2
                $data->pc_ad_img = uploadImg('pc_ad_img', 'shop');
                $data->mb_ad_img = uploadImg('mb_ad_img', 'shop');
                // $data->right_img_three = uploadImg('right_img_three');      // 右图3
            }
        });
    }
}